﻿using System;
using System.Collections.Generic;
using System.Linq;
using Game.Command.Internal;
using Game.Map;
using Game.Objects;

namespace Game.Command
{
    public static class Factory
    {
        readonly static List<GameCommand> _GlobalCommands = new List<GameCommand>();

        static Factory()
        {
            _GlobalCommands.Add(new ShowAllCommand());
            _GlobalCommands.Add(new FireGameSuccessCommand());
        }

        public static GameCommand GetGlobalCommand(string name)
        {
            return _GlobalCommands.FirstOrDefault(
                command => command.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
        }

        public static GameCommand CreateMoveUnitCommand(
            IGameMapView map,
            GamePath path, 
            Vehicle vehicle)
        {
            return new MoveUnitCommand(map, path, vehicle);
        }
    }
}
